#include <myheader.h>

/*Usage:  */
int main(int argc, char *argv[])
{
    //定义两个字符串
    char* ip = "192.168.171.1";
    in_port_t port = 1035;

    //将ip和端口号字符串转换成无符号长整型
    unsigned  s_addr = inet_addr(ip);
    unsigned short s_port = htons(port);

    //定义结构体
    struct sockaddr_in sock;
    sock.sin_family = AF_INET;
    sock.sin_port = s_port;
    sock.sin_addr.s_addr = s_addr;
    for(int i = 0; i<sizeof(sock.sin_zero); i++){
        sock.sin_zero[i] = 0;;
    }
    printf("s_addr = %u\n",sock.sin_addr.s_addr);
    printf("s_port = %u\n",sock.sin_port);

    return 0;
}

